/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: Dec 31, 2009
 * Time: 10:59:08 AM
 * To change this template use File | Settings | File Templates.
 */
import java.util.*;

// Referenced classes of package dk.brics.jwig.analysis.summarygraph:
//            Node

public class TemplateEdge
{

    private TemplateEdge()
    {
    }

    public TemplateEdge(Node node, String s, Object obj)
    {
        to = node;
        gap = s;
        origins = new HashSet();
        origins.add(obj);
    }

    public TemplateEdge(Node node, String s, Collection collection)
    {
        to = node;
        gap = s;
        origins = new HashSet(collection);
    }

    public Node getDestination()
    {
        return to;
    }

    public Collection getOrigins()
    {
        return origins;
    }

    public String getGap()
    {
        return gap;
    }

    public Object clone()
    {
        TemplateEdge templateedge = new TemplateEdge();
        templateedge.to = to;
        templateedge.gap = gap;
        templateedge.origins = new HashSet(origins);
        return templateedge;
    }

    public boolean equals(Object obj)
    {
        if(obj instanceof TemplateEdge)
        {
            TemplateEdge templateedge = (TemplateEdge)obj;
            return to == templateedge.to && gap.equals(templateedge.gap);
        } else
        {
            return false;
        }
    }

    public int hashCode()
    {
        return to.hashCode() * 2 + gap.hashCode() * 3;
    }

    Node to;
    String gap;
    Set origins;
}
